'use strict';
module.exports = {
	/**
	 * XXXnameXXX
	 * @url admin/pages/kh/userdatagl/order/getStatusGroup 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let {
			data = {}, userInfo, util, filterResponse, originalParam
		} = event;
		let {
			customUtil,
			uniID,
			config,
			pubFun,
			vk,
			db,
			_,
			$
		} = util;
		let {
			uid,
		} = data;
		let res = {
			code: 0,
			msg: ""
		};
		// 业务逻辑开始-----------------------------------------------------------
		let dbName = "daoju_order"; // 表名
		
		let result = {}
	

		result.count_info = await vk.baseDao.selects({
			dbName,
			getMain: true,
			groupJson: {
				_id: "$status",
				status: $.first("$status"),
				count: $.sum(1), // count记录条数
			},
			whereJson: {
				user_id: uid,
				status:_.neq(-1)
			}
		});

		res.data = result

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
